<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let name = "哈哈";
        let age = 100;

        // let obj = {
        //     name:name,  //键和值(变量名)名字相同
        //     age:age,
        //     fn:function(){
        //         console.log(111,this);
        //     }
        // };
        // console.log(obj);
        // obj.fn();


        let obj = {
            name,  //键和变量名字相同简写
            age,
            fn() {  //简化形式,只是简写了,特性不改变的
                console.log(111, this);
            }
        };
        console.log(obj);
        obj.fn();
    </script>
</body>

</html>